<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>


        // hasOwnProperty()  判断某个属性或者方法是不是实例化对象自身所拥有的

        function Dog(name, age) {
            this.name = name;
            this.age = age;
            this.fn = function () { }
        }

        Dog.prototype.type = '狗子';
        Dog.prototype.say = function () {
            console.log('wang');
        }


        const d = new Dog('哈士奇', 3);

        console.log(d);

        console.log(d.hasOwnProperty('name'));   // true

        console.log(d.hasOwnProperty('name'));   // false


        console.log(d.hasOwnProperty('fn'));

    </script>

</body>

</html>